package com.aoplog.springbootaoplog.controller;

import com.aoplog.springbootaoplog.annotation.Log;
import com.aoplog.springbootaoplog.domain.SysOperLog;
import com.aoplog.springbootaoplog.enums.BusinessType;
import com.aoplog.springbootaoplog.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SysOperLogController {
    @Autowired
    private ISysOperLogService iSysOperLogService;

    /**
     * 查询全部日志   加操作日志
     *
     * @return
     */
    @GetMapping("/api/operLog")
    @Log(title = "查询全部日志", businessType = BusinessType.SELECT)
    public List<SysOperLog> selectOperLogList1() {
        return this.iSysOperLogService.selectOperLogList(null);
    }


    /**
     * 修改日志   加操作日志
     *
     * @return
     */
    @GetMapping("/api/operLog/{id}")
    @Log(title = "修改日志", businessType = BusinessType.UPDATE)
    public List<SysOperLog> updateOperLog(@PathVariable("id") Long id) {
        //不做实际操作
        return this.iSysOperLogService.selectOperLogList(null);
    }

    /**
     * 查询全部日志
     *
     * @return
     */
    @GetMapping("/operLog")
    public List<SysOperLog> selectOperLogList2() {
        return this.iSysOperLogService.selectOperLogList(null);
    }
}
